<template>
  <a-modal :title='"认款使用明细--收款金额:"+takeAmount' width='80%'  :dialog-style="{ top: '10px' }" :visible='visible' :confirmLoading='loading' :footer='null'  @cancel='close'>
    <f-table ref='table' v-if='visible' rowKey='paymentOrderId' :showTotal='true' :tableColumns='columns' :multiple='false' :operator='operator' :showPagination='false' :params='queryParam' :api='api.paymentOrder.list' handler='paymentOrderSelectPageListHandler'>
      <span slot='sendType' slot-scope='text, record, index'>
          <a-tag color='#2db7f5' v-if='text==1'>现款</a-tag>
          <a-tag color='#FF0000' v-if='text==2'>预收款</a-tag>
          <a-tag color='#87d068' v-if='text==3'>资保金</a-tag>
          <a-tag color='purple' v-if='text==4'>全额资信</a-tag>
      </span>
    </f-table>
  </a-modal>
</template>
<script>
import api from "../js/api"

export default {
  name: "SelectPaymentOrderModal",
  props: {},
  data() {
    let operator = []
    return {
      refs: this.$refs,
      api: Object.assign(api, this.api),
      loading: false,
      visible: false,
      selectedRowKeys: [],
      selectedRows: [],
      takeAmount:0,
      //列表初始化查询参数
      queryParam: {
        amountState: 0
      },

      // 表头
      columns: [
        {
          title: "序号",
          width: "50px",
          align: "center",
          customRender: function(text, record, index) {
            return (record.rowIndex !== "合计") ? (parseInt(index) + 1) : record.rowIndex
          }
        },
        {
          title: "发货日期",
          align: "left",
          width: "90px",
          dataIndex: "sendDate"
        },
        {
          title: "订单编号",
          width: "100px",
          align: "left",
          dataIndex: "orderNo"
        },
        {
          title: "单位名称",
          width: "140px",
          align: "left",
          ellipsis: true,
          length:25,
          dataIndex: "customName"
        },
        {
          title: "部门名称",
          width: "120px",
          ellipsis: true,
          align: "left",
          dataIndex: "deptName"
        },
        {
          title: "业务员",
          align: "left",
          ellipsis: true,
          width: "110px",
          dataIndex: "saleManName"
        },
        {
          title: "业务编码",
          align: "center",
          width: "110px",
          dataIndex: "businessCode"
        },
        {
          title: "发货方式",
          align: "center",
          width: "60px",
          dataIndex: "sendType",
          scopedSlots: { customRender: "sendType" }
        },
        {
          title: "制单人",
          align: "center",
          width: "60px",
          dataIndex: "nickName",
        },
        {
          title: "发货金额",
          align: "left",
          width: "100px",
          dataIndex: "totalSaleAmount",
          needTotal: true
        }
      ],
      operator: operator
    }
  },
  methods: {
    open(params) {
      this.queryParam = params
      this.visible = true
      this.selectedRowKeys = []
      this.selectedRows = []
      this.takeAmount=params.amount;
      this.$refs.table.refresh(true, params)
    },
    close() {
      this.$emit("close")
      this.visible = false
    }
  },
  created() {
  },
  components: {}
}
</script>

<style scoped lang='less' rel='stylesheet/less'>

</style>
